<?php

/**
 * This is the model class for table "luasareaperkebunanbesar".
 *
 * The followings are the available columns in table 'luasareaperkebunanbesar':
 * @property integer $lapb_id
 * @property string $lapb_jenis
 * @property double $lapb_swasta_area
 * @property double $lapb_swasta_produksi
 * @property double $lapb_negara_area
 * @property double $lapb_negara_produksi
 * @property double $lapb_jumlah_area
 * @property double $lapb_jumlah_produksi
 * @property integer $lapb_tahun
 */
class Luasareaperkebunanbesar extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Luasareaperkebunanbesar the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'luasareaperkebunanbesar';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('lapb_tahun', 'numerical', 'integerOnly'=>true),
			array('lapb_swasta_area, lapb_swasta_produksi, lapb_negara_area, lapb_negara_produksi, lapb_jumlah_area, lapb_jumlah_produksi', 'numerical'),
			array('lapb_jenis', 'length', 'max'=>64),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('lapb_id, lapb_jenis, lapb_swasta_area, lapb_swasta_produksi, lapb_negara_area, lapb_negara_produksi, lapb_jumlah_area, lapb_jumlah_produksi, lapb_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'lapb_id' => 'Lapb',
			'lapb_jenis' => 'Jenis Tanaman',
			'lapb_swasta_area' => 'Area Per. Swasta',
			'lapb_swasta_produksi' => 'Produksi Per. Swasta',
			'lapb_negara_area' => 'Area Per. Negara',
			'lapb_negara_produksi' => 'Produksi Per. Negara',
			'lapb_jumlah_area' => 'Jumlah Area',
			'lapb_jumlah_produksi' => 'Jumlah Produksi',
			'lapb_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('lapb_id',$this->lapb_id);
		$criteria->compare('lapb_jenis',$this->lapb_jenis,true);
		$criteria->compare('lapb_swasta_area',$this->lapb_swasta_area);
		$criteria->compare('lapb_swasta_produksi',$this->lapb_swasta_produksi);
		$criteria->compare('lapb_negara_area',$this->lapb_negara_area);
		$criteria->compare('lapb_negara_produksi',$this->lapb_negara_produksi);
		$criteria->compare('lapb_jumlah_area',$this->lapb_jumlah_area);
		$criteria->compare('lapb_jumlah_produksi',$this->lapb_jumlah_produksi);
		$criteria->compare('lapb_tahun',$this->lapb_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}